﻿CREATE TABLE [dbo].[SupplierService] (
    [ServiceId]   UNIQUEIDENTIFIER NOT NULL DEFAULT newid(),
    [ServiceType] VARCHAR (26)     NOT NULL,
    [SupplierId]  UNIQUEIDENTIFIER NOT NULL,
    [IsFixedCost] BIT              DEFAULT ((0)) NOT NULL,
    [FixedCost]   MONEY            NULL,
    [IsActive]   BIT               CONSTRAINT [DF_SupplierService_IsActive] DEFAULT ((1)) NOT NULL,
    [DateCreated]  DATETIME         DEFAULT (getdate()) NOT NULL,
    [CreatedBy]    VARCHAR (50)     DEFAULT (suser_sname()) NOT NULL,
    [DateModified] DATE             NULL,
    [ModifiedBy]   VARCHAR (50)     NULL,
    CONSTRAINT [PK_SupplierService] PRIMARY KEY CLUSTERED ([ServiceId] ASC),
    CONSTRAINT [FK_SupplierService_ServiceType] FOREIGN KEY ([ServiceType]) REFERENCES [dbo].[ServiceType] ([ServiceType]),
    CONSTRAINT [FK_SupplierService_Supplier] FOREIGN KEY ([SupplierId]) REFERENCES [dbo].[Supplier] ([SupplierId])
);


GO

CREATE INDEX [IX_SupplierService_ServiceType] ON [dbo].[SupplierService] ([ServiceType])

GO

CREATE INDEX [IX_SupplierService_SupplierId] ON [dbo].[SupplierService] ([SupplierId])
